package com.longnows.appserver.core.configuration;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

@Component
@ConfigurationProperties(prefix = "longnows")
@PropertySource(value = "classpath:config/exception-code.properties", encoding = "UTF-8")
public class ExceptionCodeConfiguration {

   public Map<Integer,String> codes=new HashMap<>();

    public Map<Integer, String> getCodes() {
        return codes;
    }

    public void setCodes(Map<Integer, String> codes) {
        this.codes = codes;
    }

    public String getMessage(Integer code){
        String mesaage = codes.get(code);
        return  mesaage;
    }

}
